package com.lyw.forum.common.utils;

import com.lyw.forum.pojo.dataobject.Article;
import com.lyw.forum.pojo.dataobject.ArticleReply;
import com.lyw.forum.pojo.dataobject.Message;

import java.util.Date;

public class SetDefaultUtils {
    public static Article setArticleRequestDefault(Article article) {
        //设置默认值
        article.setVisitCount(0); // 访问数
        article.setReplyCount(0); // 回复数
        article.setLikeCount(0);  // 点赞数
        article.setDeleteState((byte) 0);
        article.setState((byte) 0);
        article.setCreateTime(new Date());
        article.setUpdateTime(new Date());

        return article;
    }

    public static ArticleReply setArticleReplyRequestDefault(ArticleReply articleReply) {
        //设置默认值
        articleReply.setLikeCount(0);
        articleReply.setDeleteState((byte) 0);
        articleReply.setState((byte) 0);
        articleReply.setCreateTime(new Date());
        articleReply.setUpdateTime(new Date());

        return articleReply;
    }

    public static Message setMessageRequestDefault(Message message) {
        //设置默认值
        message.setDeleteState((byte) 0);
        message.setState((byte) 0);
        message.setCreateTime(new Date());
        message.setUpdateTime(new Date());

        return message;
    }
}
